package com.kitchen.ui.controls.friends.button
{
	import com.kitchen.AbstractButton;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.text.StyleSheet;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;

	public class GFriendButton extends AbstractButton
	{
		private var label:String;
		
		public function GFriendButton(bitdata:BitmapData, label:String)
		{
			this.label = label;
			super(bitdata);
			
		}
		
		override protected function layout(bitdata:BitmapData):void{
			this.bitmap = new Bitmap(this.getBitmapData(bitdata));
			var shape:Shape = new Shape();
			shape.graphics.beginFill(0xffffff, 1);
			shape.graphics.drawRect(0, 0, this.w, this.h);
			shape.graphics.endFill();
			this.mask = shape;
			this.addChild(shape);
			this.addChild(this.bitmap);
			var tf:TextField = new TextField();
			tf.htmlText = this.label;
			tf.selectable = false;
			tf.autoSize = TextFieldAutoSize.LEFT;
			tf.x = 10;
			tf.y =5;
			var style:StyleSheet = new StyleSheet();
			var h:Object = new Object();
			h.color = 0xb45620;
			h.fontSize=15;
			h.fontWeight = "bold";
			style.setStyle('.h', h);
			var c:Object = new Object();
			c.fontSize = 12;
			c.color = 0x814916;
			style.setStyle('.c', c);
			tf.styleSheet = style;
			this.addChild(tf);
		}
		
		override protected function getBitmapData(bitdata:BitmapData):BitmapData{
			this.h = 30;
			this.w = 95;
			var cbitdata:BitmapData = new BitmapData(this.w, this.h);
			cbitdata.copyPixels(bitdata, new Rectangle(668, 415, this.w, this.h), new Point());
			return cbitdata;
		}
		
		override protected function onMouseOver(me:MouseEvent):void{
			
		}
		
		override protected function onMouseDown(me:MouseEvent):void{
			
		}
		
	}
}